using System.Data;
using Chaotic.DataBase.DataAccess;

namespace Chaotic.DataBase.MSSQLAccess;

public class DbTypeEnum : IDbTypeEnum
{
	public int GetTypeEnum(string? dbType)
	{
		switch (dbType.Trim().ToUpper())
		{
		case "BIT":
			return SqlDbType.Bit.GetHashCode();
		case "BINARY":
			return SqlDbType.Binary.GetHashCode();
		case "BIGINT":
			return SqlDbType.BigInt.GetHashCode();
		case "CHAR":
			return SqlDbType.Char.GetHashCode();
		case "DATETIME":
			return SqlDbType.DateTime.GetHashCode();
		case "DECIMAL":
			return SqlDbType.Decimal.GetHashCode();
		case "FLOAT":
			return SqlDbType.Float.GetHashCode();
		case "IMAGE":
			return SqlDbType.Image.GetHashCode();
		case "INT":
			return SqlDbType.Int.GetHashCode();
		case "MONEY":
			return SqlDbType.Money.GetHashCode();
		case "TEXT":
			return SqlDbType.Text.GetHashCode();
		case "TIMESTAMP":
			return SqlDbType.Timestamp.GetHashCode();
		case "VARCHAR":
		case "STRING":
			return SqlDbType.VarChar.GetHashCode();
		case "NVARCHAR":
			return SqlDbType.NVarChar.GetHashCode();
		default:
			return 0;
		}
	}
}
